package com.bw.search.server.controller;


import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.bw.common.core.domain.R;
import com.bw.search.domain.SkuEsModel;
import com.bw.search.server.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping("/es/save")
public class EsSaveController {


    @Autowired
    private ProductService productService;


    /**
     * 状态上架(es)
     */
    @PostMapping("/productStatusUp")
    public R productStatusUp(@RequestBody  String data)  {
        List<SkuEsModel> skuEsModelList = JSONArray.parseArray(data, SkuEsModel.class);
        productService.productStatsUp(skuEsModelList);
        return R.ok();
    }
}
